Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7519787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:57:36+00:00 2026-05-30T01:57:36+00:00

The linux/ folder contains the ip.h header file, wherein part of the structure of

  • 0

The linux/ folder contains the ip.h header file, wherein part of the structure of IP header is defined as follows:

struct iphdr
{
     // ...
     __be32 saddr;
     __be32 daddr;
};

I have a situation wherein I have a source netmask of type char*. I want to check whether a IP address of type __be32 belongs to a network with address of type char*. I can convert netmask and network address to __be32 using in_aton() provided in linux/inet.h.

 char * network_addr = "192.166.0.0";
 char * netmask = "255.255.0.0";

Can someone please tell how can I take the boolean && of addresses being type __be32 or just applying && operator will give correct result.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:57:37+00:00Added an answer on May 30, 2026 at 1:57 am

    You are looking for the bitwise AND operator & and not the logical AND operator &&:

    __be32 addr;
    __be32 addr_mask;
    ...
    __be32 addr_masked = addr & addr_mask;
    

    Remember IPv4 adresses are 32-bit number: 4 x 8-bit bytes

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my current setup is as follows: We have a Linux samba share that contains
As the title says, I'm using Linux, and the folder could contain more than
In my home folder in Linux I have several config files that have rc
In Linux, mkdir -p creates a folder tree. What is the equivalent option in
after installing XAMPP on linux i have seen the folder htdocs belongs to nobody.
In Linux zip, is it possible to zip a folder recursively except for a
In Linux, can one set a custom icon for a folder/directory as it appears
Take folder files , inside an SVN working copy, running in Linux. The folder
How can I replace the same text in folder names in linux? Say I
Where is the default location for the folder ~/.vim/syntax/ on a Linux system? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.